import QtQuick
import QtQuick.Controls
import Qt.labs.platform as Platform // 解决命令冲突
import QtQuick.Controls.Material // for 移动版
import ".." // for search ImageViwerWindow.qml

ImageViewerWindow{
    id: window
    width: 320; height: 480
    visible: true
    title: qsTr("Image Viewer")

    header: ToolBar {
        Material.background: Material.Orange
        ToolButton {
            icon.source: "../images/menu"
            onClicked: drawer.open()
        }
        Label {
            anchors.centerIn: parent
            text: "Image Viwer"
            font.pixelSize: 20
        }
    }

    Drawer {
        id: drawer
        width: parent.width * 2 / 3
        height: parent.height

        ListView {
            anchors.fill: parent
            model: ListModel {
                ListElement {
                    text: qsTr('open...')
                    triggered: function() { window.openFileDialog(); }
                }
                ListElement {
                    text: qsTr('About...')
                    triggered: function() { window.openAboutDialog(); }
                }
            }

            delegate: ItemDelegate {
                text: model.text
                highlighted: ListView.isCurrentItem
                onClicked: {
                    drawer.close()
                    model.triggered()
                }
            }
        }
    }
}
